from django.conf.urls import url
from django.urls import include

from web.views import account, project, manage, wiki, file, issuse,dashboard,statistics
urlpatterns = [
    # 登录、注册短信
    url("goto/", account.sms_to),
    # 生成验证码图片
    url("img/code/", account.img_code),
    # 注册
    url("register/", account.register, name="reg"),
    url("paslogin/", account.login, name="login"),
    url("msglogin/", account.msg_login),
    url("logout/", account.logout),
    # 首页
    url(r"index/", account.index, name="index"),
    # 项目列表
    url("project/list/", project.list, name="project_list"),
    url("project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$", project.star, name="project_star"),
    url("project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$", project.unstar, name="project_unstar"),
    # 支付
    url("pay_info/$", project.pay_index, name="pay_index"),
    url("pay/(?P<price_type>\w+)/$", project.payment, name="payment"),
    url("pay/$", project.pay, name="pay"),
    url("pay_notify/$", project.notify, name="notify"),

    # 项目管理
    url(r"manage/(?P<project_id>\d+)/", include([
        # 项目首页等
        url(r'dashboard/$', dashboard.dashboard, name='dashboard'),
        url(r'char_info/$', dashboard.char_info, name='char_info'),
        # 统计
        url(r'statistics/$', statistics.statistics, name='statcstics'),
        url(r'stati/pie_info/$', statistics.pie_info, name='pie_info'),
        url(r'stati/line_info/$', statistics.line_info, name='line_info'),
        # wiki管理
        url(r'wiki/$', wiki.wiki, name='wiki'),
        url(r'wiki/add/$', wiki.add, name='wiki_add'),
        url(r'wiki/delete/(?P<wiki_id>\d+)/', wiki.delete, name='wiki_delete'),
        url(r'wiki/edit/(?P<wiki_id>\d+)/', wiki.edit, name='wiki_edit'),
        url(r'wiki/catalog/$', wiki.catalog, name='wiki_catalog'),
        url(r'wiki/upload/', wiki.upload, name='wiki_upload'),
        url(r'setting/$', manage.setting, name='setting'),
        # 文件管理
        url(r'file/$', file.file, name='file'),
        url(r'file/delete/$', file.delete, name='delete'),
        url(r'get/cors_token/', file.get_cors_token, name='cors_token'),
        # 问题管理
        url(r'issues/$', issuse.issues, name='issues'),
        url(r'issues/(?P<issues_id>\d+)/edit/$', issuse.edit, name='edit'),
        url(r'issues/(?P<issues_id>\d+)/record/$', issuse.record, name='record'),
        url(r'issues/(?P<issues_id>\d+)/update/$', issuse.update, name='update'),
        url(r'issues/(?P<issues_id>\d+)/update/$', issuse.update, name='update'),
        # 生成验证码
        url(r'invite/$', issuse.invite, name='invite'),

    ], None)),

    # 加入邀请码
    url(r'^invite/join/(?P<code>\w+)/$', issuse.invite_join, name='invite_join'),

]




